package net.sareweb.acab.session;

import net.sareweb.acab.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("avatarList")
public class AvatarList extends EntityQuery<Avatar> {

	private static final String EJBQL = "select avatar from Avatar avatar";

	private static final String[] RESTRICTIONS = {
			"lower(avatar.name) like lower(concat(#{avatarList.avatar.name},'%'))",
			"lower(avatar.format) like lower(concat(#{avatarList.avatar.format},'%'))",
			"lower(avatar.type) like lower(concat(#{avatarList.avatar.type},'%'))", };

	private Avatar avatar = new Avatar();

	public AvatarList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Avatar getAvatar() {
		return avatar;
	}
}
